widget: Include box-shadow in the clip
authorBenjamin Otte <otte@redhat.com>
Fri, 23 May 2014 13:52:16 +0000 (15:52 +0200)
committerBenjamin Otte <otte@redhat.com>
Sat, 24 May 2014 14:12:21 +0000 (16:12 +0200)
This allows all widgets that implement clip to use box shadows.

gtk/gtkcssstylepropertyimpl.c
gtk/gtkwidget.c

index 4bb85477382c2884a3a71fd144f3f113780cad92..f1acf9a13b2a6b87fb3434159586940062f50283 100644 (file)
@@ -1013,7 +1013,7 @@ _gtk_css_style_property_init_properties (void)
   gtk_css_style_property_register        ("box-shadow",
                                           GTK_CSS_PROPERTY_BOX_SHADOW,
                                           G_TYPE_NONE,
-                                          GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
+                                          GTK_STYLE_PROPERTY_ANIMATED,
                                           shadow_value_parse,
                                           NULL,
                                           NULL,
index 70dd74eb1f23d899d584bb7f125229748d0c02a7..5a9b8b7c05eba3958ba805db1625ed67e2e14010 100644 (file)
@@ -39,6 +39,7 @@
 #include "gtkclipboard.h"
 #include "gtkcssstylepropertyprivate.h"
 #include "gtkcssnumbervalueprivate.h"
+#include "gtkcssshadowsvalueprivate.h"
 #include "gtkintl.h"
 #include "gtkmarshalers.h"
 #include "gtkselectionprivate.h"
@@ -15447,10 +15448,22 @@ union_with_clip (GtkWidget *widget,
 void
 _gtk_widget_set_simple_clip (GtkWidget *widget)
 {
+  GtkStyleContext *context;
   GtkAllocation clip;
+  GtkBorder extents;
+
+  context = gtk_widget_get_style_context (widget);
 
   gtk_widget_get_allocation (widget, &clip);
 
+  _gtk_css_shadows_value_get_extents (_gtk_style_context_peek_property (context,
+                                                                        GTK_CSS_PROPERTY_BOX_SHADOW),
+                                      &extents);
+  clip.x -= extents.left;
+  clip.y -= extents.top;
+  clip.width += extents.left + extents.right;
+  clip.height += extents.top + extents.bottom;
+
   if (GTK_IS_CONTAINER (widget))
     gtk_container_forall (GTK_CONTAINER (widget), union_with_clip, &clip);